package com.tian.authen.controller;


import com.tian.authen.controller.request.OauthAccessTokenId;
import com.tian.authen.controller.response.OauthAccessTokenResponse;
import com.tian.authen.service.IOauthAccessToken;
import com.tian.common.result.BaseResult;
import com.tian.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;


/**
 *
 * <pre>
 *     认证服务
 * </pre>
 * @author zhump
 */
@RestController
@RequestMapping(value = "/accessToken")
@Api(tags = "oauth-access-token")
public class OauthAccessTokenController {

    @Autowired
    private IOauthAccessToken oauthAccessToken;

    @RequestMapping(value = "/getTokenId",method = RequestMethod.POST)
    @ApiOperation(value = "getTokenId controller")
    public BaseResult<OauthAccessTokenResponse> test(@Valid @RequestBody OauthAccessTokenId request){
        return Result.ok(oauthAccessToken.getAccessToken(request.getToken()));
    }
}
